﻿using MiPWinRTSDK.Interfaces;
using MiPWinRTSDK.MiP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Bluetooth.GenericAttributeProfile;
using Windows.Devices.Enumeration;
using Windows.Foundation;

namespace MiPWinRTSDK
{
    public sealed class MiPFactory
    {
        public static IMiPRobot CreateMiP(DeviceInformation device)
        {
            return new MiPRobot(device);
        }

        public static IMiPosaur CreateMiPosaur(DeviceInformation device)
        {
            return new MiPosaur(device);
        }

        public static IAsyncOperation<IList<DeviceInformation>> GetPairedMiPDevices()
        {
            return getPairedMiPDevices().AsAsyncOperation();
        }

        private  async static Task<IList<DeviceInformation>> getPairedMiPDevices()
        {
            return (await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(new Guid("0000ffe5-0000-1000-8000-00805f9b34fb")))).ToList();
        }
    }
}
